﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using XiaoGang.Soft.XGWMS.COM;
using XiaoGang.Soft.XGWMS.MODEL;

namespace XiaoGang.Soft.XGWMS.DAL_SQL
{
    public partial class DAL_M014_MerberBuy
    {
        public ReturnValue Add ( MOD_M014_MerberBuy model )
        {           
            SqlParameter[] parameters = {
					new SqlParameter("@UPDATER_ID", SqlDbType.VarChar,12),
					new SqlParameter("@TERMINAL_CD", SqlDbType.VarChar,256),
					new SqlParameter("@ID", SqlDbType.VarChar,50),
					new SqlParameter("@USER_ID", SqlDbType.VarChar,50),
					new SqlParameter("@GOODS_NAME", SqlDbType.NVarChar,100),
					new SqlParameter("@PRICE", SqlDbType.Decimal,9),
					new SqlParameter("@NUITS", SqlDbType.Int,4),
					new SqlParameter("@TOTAL", SqlDbType.Decimal,9),
					new SqlParameter("@DATETEME", SqlDbType.DateTime)};
            parameters[0].Value = model.UPDATER_ID;
            parameters[1].Value = model.TERMINAL_CD;
            parameters[2].Value = model.ID;
            parameters[3].Value = model.USER_ID;
            parameters[4].Value = model.GOODS_NAME;
            parameters[5].Value = model.PRICE;
            parameters[6].Value = model.NUITS;
            parameters[7].Value = model.TOTAL;
            parameters[8].Value = model.DATETEME;
            return XGWMS.DBUtility.SqlHelper.ExecuteSql( Insert_SQL, parameters);
        }

        public ReturnValue Update ( MOD_M014_MerberBuy model )
        {            
            SqlParameter[] parameters = {
					new SqlParameter("@UPDATER_ID", SqlDbType.VarChar,12),
					new SqlParameter("@TERMINAL_CD", SqlDbType.VarChar,256),
					new SqlParameter("@ID", SqlDbType.VarChar,50),
					new SqlParameter("@USER_ID", SqlDbType.VarChar,50),
					new SqlParameter("@GOODS_NAME", SqlDbType.NVarChar,100),
					new SqlParameter("@PRICE", SqlDbType.Decimal,9),
					new SqlParameter("@NUITS", SqlDbType.Int,4),
					new SqlParameter("@TOTAL", SqlDbType.Decimal,9),
					new SqlParameter("@DATETEME", SqlDbType.DateTime)};
            parameters[0].Value = model.UPDATER_ID;
            parameters[1].Value = model.TERMINAL_CD;
            parameters[2].Value = model.ID;
            parameters[3].Value = model.USER_ID;
            parameters[4].Value = model.GOODS_NAME;
            parameters[5].Value = model.PRICE;
            parameters[6].Value = model.NUITS;
            parameters[7].Value = model.TOTAL;
            parameters[8].Value = model.DATETEME;
            return XGWMS.DBUtility.SqlHelper.ExecuteSql (Update_SQL, parameters);
        }

        public ReturnValue Delete ( string ID )
        {
            SqlParameter[] parameters = {
					new SqlParameter("@ID", SqlDbType.VarChar,50)};
            parameters[0].Value = ID;
            return XGWMS.DBUtility.SqlHelper.ExecuteSql (Delete_SQL, parameters);
        }

        public ReturnValue GetList(string MemberID)
        {
            SqlParameter[] parameters = {
					new SqlParameter("@USER_ID", SqlDbType.VarChar,50)};
            parameters[0].Value = MemberID;
            return XGWMS.DBUtility.SqlHelper.Query(GetList_SQL, parameters);
        }
    }
}
